package com.xinxing.learning.test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.io.Reader;
import java.util.List;

@Service
public class Client {
    private ParserFactory parserFactory;

    @Autowired
    public Client(ParserFactory parserFactory) {
        this.parserFactory = parserFactory;
    }

    public List getAll(ContentType contentType) {
        return parserFactory.getParser(contentType).parse(new Reader() {
            @Override
            public int read(char[] cbuf, int off, int len) throws IOException {
                return 0;
            }

            @Override
            public void close() throws IOException {

            }
        });
    }
}
